package com.bailugansan.efficiencyboard.controller;

import com.bailugansan.efficiencyboard.entity.pool.InitPoolEntity;
import com.bailugansan.efficiencyboard.service.PoolService;
import com.bailugansan.efficiencyboard.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author BailuGansan
 */

@RestController
@RequestMapping("/init")
public class InitController {

    @Autowired
    private PoolService poolService;

    @PostMapping(value = "/initPool")
    public R initPool(@RequestBody InitPoolEntity entity){
        System.out.println(entity.getUsername());

        // TODO 增加池子任务带锚点
        boolean result = poolService.init(entity.getUsername());
        System.out.println("result" + result);
        return R.ok().put("data", "");
    }
}
